Class TVShow


  • public class TVShow
    extends Event
    represents the appearance of an artist in (a certain edition of) a TVShow as a specific event. e.g. "Johnny Cash" on "The Tonight Show".
    Since:
    ExerciseSheet03
    Version:
    1
    Author:
    Jonas Altrock (ew20b126@technikum-wien.at)
    • Field Detail

      • name

        private java.lang.String name
        the name of this TV show

        The name of a TVShow cannot be empty or composed of whitespace only.

      • viewers

        private int viewers
        the number of viewers of this TVShow

        must be non-negative, 0 means unknown

    • Constructor Detail

      • TVShow

        public TVShow()
        creates a default TVShow

        a default TVShow is a default event with an unknown name and an unknown number of viewers.

      • TVShow

        public TVShow​(Event e)
        creates a TV show from an event

        this constructor performs some kind of promotion such that it takes a generic event and creates a TV show which is a (deep) copy of the original event. The resulting TV show has unknown name and unknown viewers.

        Parameters:
        e - - the event to copy/promote to TV show
      • TVShow

        public TVShow​(TVShow tvs)
        creates a deep copy of a TVShow
        Parameters:
        tvs - - the TV show to copy
    • Method Detail

      • getViewers

        public int getViewers()
        gets the number of viewers of this TVShow
        Returns:
        the viewers
      • setViewers

        public void setViewers​(int v)
        sets the viewers of this TVshow

        illegal arguments are ignored

        Parameters:
        v - - the number of viewers to set
      • getName

        public java.lang.String getName()
        gets the name of this TVShow
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
        sets the name of this TVShow

        illegal arguments are ignored

        Parameters:
        name - - the name to set
      • toString

        public java.lang.String toString()
        returns a String representation of this TV

        show the string representation of a TV show is (without quotes):

         "artist name" @ "show name" on "date"
         "description"
         ("audience" attending ("impact"))
         
        audience are all viewers and attendees of a show
        Overrides:
        toString in class Event
        Returns:
        the string representation
      • impact

        public int impact()
        returns the impact of this event

        the impact is an estimation of the number of people who took notice of this event for a TV show event, the impact is the audience times 2. audience are all viewers and attendees of a show

        Overrides:
        impact in class Event
        Returns:
        the impact